﻿@using ForzaGT3.Data
@using ForzaGT3.Common.Configuration
@model IEnumerable<News>
@{
    ViewBag.Title = "Index";
    ViewBag.ActiveMenu = "News";
    string lang = string.Empty;
    if (!string.IsNullOrEmpty(Request.QueryString["lang"]))
    {
        lang = Request.QueryString["lang"];
    }
}
<div class="contentheader header shadow">
    LATEST NEWS
</div>
@if (Model != null)
{
    if (!string.IsNullOrEmpty(lang))
    {
        foreach (News data in Model)
        {
            <div class="newscontent">
                <div class="greybgtxt">
                    <img src="@Url.Content("~" + data.ImageUrl)" alt="@data.ImageText" style="width:640px;" />
                    @data.CreatedDate.ToString("dd MMMM yyyy")
                    <hr />
                    <h3>@data.NewsTitleEng</h3>
                    <p>@MvcHtmlString.Create(data.NewsIntroEng)</p>
                    <a href="@Url.Action("Details", "News", new { lang = lang, Id = data.NewsUrl})">read more</a>
                </div>
            </div>
        }
    }
    else
    {
        foreach (News data in Model)
        {
            <div class="newscontent">
                <div class="greybgtxt">
                    <img src="@Url.Content("~" + data.ImageUrl)" alt="@data.ImageText" style="width:640px;" />
                    @data.CreatedDate.ToString("dd MMMM yyyy")
                    <hr />
                    <h3>@data.NewsTitle</h3>
                    <p>@MvcHtmlString.Create(data.NewsIntro)</p>
                    <a href="@Url.Action(MVC.News.Details(data.NewsUrl))">read more</a>
                </div>
            </div>
        }
    }
    if (Model.Count() > 10)
    {
        <div id="paging">
            <a href="#">First Page</a> <a href="#">Previous</a> <a href="#" class="number"><<</a>
            <a href="#" class="number">1</a> <a href="#" class="number">2</a> <a href="#" class="number">
                3</a> <a href="#" class="number">>></a> <a href="#">Next</a> <a href="#">Last Page</a>
        </div>
    }
}